Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent broken Tickets pages when tickets have been sold #973

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

timiwahalahti
Copy link
Collaborator

@timiwahalahti timiwahalahti commented Jul 21, 2023

Removing the shortcode from the tickets page, or changing its slug or publicity breaks the ability to refund tickets, etc.

This PR aims to prevent removal of camptix shortcode, change in page publicity or slug when tickets have been sold.

Fixes #402

Props @iandunn

TODO

  • Add notification on edit view to tell that tickets have been sold so these actions cannot be taken
  • Test Gutenberg
  • Move the function to a better place

Screenshots

Warning when changes are prevented, block editor.
image

Warning when changes are prevented, classic editor.
image

Error when changes are tried, block editor.
image

Error when changes are tried, classic editor.
image

How to test the changes in this Pull Request:

  1. Open WordCamp site dashboard, ensure that no tickets have been sold and tickets page is draft
  2. Update the tickets page, and change slug for example -> updating should work
  3. Publish the page, remove camptix shortcode this time -> updating should work
  4. Add the shortcode back and buy one ticket
  5. Open the tickets page in classic editor -> you should see warning
  6. Open the tickets page in block editor -> you should see warning
  7. Update the page on block editor, change slug -> you should get error
  8. Update the page on block editor, remove camptix shortcode -> you should get error
  9. Update the page on classic editor, try to change staus back to draft -> you should get error

@timiwahalahti timiwahalahti marked this pull request as ready for review July 22, 2023 09:28
Copy link
Member

@iandunn iandunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@iandunn iandunn merged commit fb1cd6d into WordPress:production Oct 10, 2023
3 checks passed
}

// Cannot change the slug anymore.
if ( $postarr['post_name'] !== $post_before->post_name ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think after you refactored in 17b1e53 $post_before is no longer in scope.

@StevenDufresne
Copy link
Contributor

I had to revert this PR.

See:
https://wordpress.slack.com/archives/C08M59V3P/p1696990191433489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] CampTix Including addons
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CampTix: Prevent broken Tickets pages when shortcode removed
3 participants